package com.ev.custom.dao;

import com.ev.custom.domain.MaterielDO;
import com.ev.custom.vo.MaterielPageParam;
import com.ev.scm.domain.StockDO;
import com.ev.scm.vo.MaterielVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 物料
 * @author ev-monitor
 * @email 286600136@qq.com
 * @date 2019-07-03 09:40:08
 */
@Mapper
public interface MaterielDao {

	MaterielDO get(Long id);

	List<MaterielVo> getMaterielS(List<Long> ids);

	List<MaterielDO> list(Map<String, Object> map);

	List<MaterielDO> listTwo(Map<String, Object> map);

	List<Map<String,Object>> listForMap(Map<String, Object> map);

	int count(Map<String, Object> map);

	int save(MaterielDO materiel);

	int update(MaterielDO materiel);

	int remove(Long id);

	int batchRemove(Long[] ids);

	int countForMap(Map<String, Object> params);

	List<MaterielDO> checkSave(MaterielDO materiel);
	/************************************/

	List<StockDO> stockList(List<Long>stockIds);

	int checkUse(Long id);

	List<Map<String,Object>> stockCount(Map<String,Object>map);

	List<Map<String,Object>> stockListForMap(Map<String, Object> map);

	List<Map<String,Object>> stockListForMap2(Map<String, Object> map);

	int stockCountForMap(Map<String, Object> map);

	List<String> getAllCode();

	void batchSave(List<MaterielDO> materielDOs);

	List<String> getAllName();

	Map<String,Object> getById(Long id);

	int batchCount(MaterielPageParam pageParam);

	List<Map<String,Object>> batchList(MaterielPageParam pageParam);

	int recoverRemoveData(Long[] ids);

	/**
	 * 根据主键集合拿到可用库存
	 * @param stockIds 主键集合
	 * @return id分组，可用库存
	 * @throws Exception 异常
	 */
	List<Map<String,Object>> findAbleCount(@Param("stockIds")String stockIds) throws Exception;

	int batchUpdate(List<MaterielDO> materiel);

	List<MaterielDO> listForAll();
}
